//通用型的定义放到type中
import { SchemaRefs } from 'ajv/dist/compile'

export enum SchemaTypes {
  //schema支持类型的列表
  'NUMBER' = 'number',
  'INTEGER' = 'integer',
  'STRING' = 'string',
  'OBJECT' = 'object',
  'ARRAY' = 'array',
  'BOOLEAN' = 'boolean',
}

type SchemaRef = { $ref: string }

//type Schema= any
/**
 * Schema的定义
 */
export interface Schema {
  //如果不加“| string”
  //就会在声明时要求必须声明为“SchemaTypes.NUMBER”
  //type决定如何去渲染Schema
  type: SchemaTypes | string
  const?: any
  format?: string
  default?: any
  properties?: {
    [key: string]: Schema | { $ref: string }
  }
  items?: Schema | Schema[] | SchemaRef
  sdependencies?: {
    [key: string]: string[] | Schema | SchemaRefs
  }
  oneOf?: Schema[]
  // vjsf?: VueJsonSchemaConfig
  requird?: string[]
  enum?: any[]
  enumKeyValue?: any[]
  additionalProperties?: any
  additionalItems?: Schema
}
